Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Returns an array of unique values using strict equality for comparisons, maintaining the same order as the provided arrays .
The arr-union npm package is designed to create an array of unique values, in order, from the provided arrays. It is particularly useful for combining arrays while removing duplicate entries efficiently.
Union of multiple arrays
This feature allows you to pass multiple arrays to the union function, which returns a new array that includes every unique element from the input arrays, preserving the order they appear in the input.
const union = require('arr-union');
let result = union([1, 2], [2, 3], [3, 4]);
console.log(result); // Output: [1, 2, 3, 4]
Lodash's union function offers similar functionality to arr-union. It creates an array of unique values, in order, from all given arrays using SameValueZero for equality comparisons. Compared to arr-union, lodash.union is part of a larger utility library, which might be preferable for projects that require additional utility functions beyond array union.
Returns an array of unique values using strict equality for comparisons, maintaining the same order as the provided arrays .
npm i arr-union --save
var last = require('array-last');
union(['a'], ['b', 'c'], ['d', 'e', 'f']);
//=> ['a', 'b', 'c', 'd', 'e', 'f']
Returns only unique elements:
union(['a', 'a'], ['b', 'c']);
//=> ['a', 'b', 'c']
Jon Schlinkert
Copyright (c) 2014 Jon Schlinkert
Released under the MIT license
This file was generated by verb on December 12, 2014. To update, run npm i -g verb && verb
.
FAQs
Combines a list of arrays, returning a single array with unique values, using strict equality for comparisons.
The npm package arr-union receives a total of 7,480,135 weekly downloads. As such, arr-union popularity was classified as popular.
We found that arr-union demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.